import { useEffect } from "react";
import { useGetCounterQuery, useSetCounterMutation, cancelToken } from "./services";

function Test() {
  const { isFetching } = useGetCounterQuery({});
  const [setCounter] = useSetCounterMutation();

  return (
    <div>
      <span
        onClick={() => {
          cancelToken();
          window.history.back();
        }}
      >
        返回
      </span>
      <h2>Test 测试</h2>
      <span onClick={() => cancelToken()}>停止请求</span>
      <p>{isFetching ? "loading... ..." : ""}</p>
      <span onClick={() => setCounter(100)}>setCounter</span>
    </div>
  );
}

export default Test;
